const {src, dest, parallel} = require('gulp');
const pug = require('gulp-pug');
const less = require('gulp-less')
const minifiyCSS = require('gulp-csso');
const concat = require('gulp-concat');

function html(){
    return src('client/templates/*.pug').pipe(pug()).pipe(dest('build/html'));
}

function css(){
    return src('client/templates/*.less').pipe(less()).pipe(minifiyCSS()).pipe(dest('build/css'));
}

function js(){
    return src('client/javascript', {sourcemaps: true}).pipe(concat('app.min.js')).pipe(dest('build/js', {sourcemaps: true}));
}

exports.js = js;
exports.js = html;
exports.js = css;
//并行不冲突
//gulp 一般不改变文件目录结构，只是产出到某个目录
exports.default = parallel(html,css,js);